import 'dart:convert' show json;

import 'package:flutter_common_app/data/protection.dart';

class ResponseData {
  ResponseData({
    this.msg,
    this.code,
    this.data,
  });

  factory ResponseData.fromJson(Map<String, dynamic> jsonRes) => jsonRes == null
      ? null
      : ResponseData(
          msg: asT<String>(jsonRes['msg']),
          code: asT<int>(jsonRes['code']),
          data: asT<dynamic>(jsonRes['data']),
        );

  String msg;
  int code;
  Map data;

  Map<String, dynamic> toJson() => <String, dynamic>{
        'msg': msg,
        'code': code,
        'data': data,
      };

  @override
  String toString() {
    return json.encode(this);
  }
}
